package com.springboot.film.service;

import com.springboot.film.entity.vipinfo;
import com.springboot.film.dao.vipinfoDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class vipinfoService {

    @Autowired
    private vipinfoDao vipinfoDao;

    /**
     * 显示总数量
     * @return
     */
    public int getCount() {
        return vipinfoDao.getCount();
    }

    /**
     * 全部分页显示
     * @return
     */
    public List<vipinfo> findByPage(int pos, int size) {
        return vipinfoDao.findByPage(pos, size);
    }

    /**
     * 显示搜索的总数量
     * @return
     */
    public int getsearchCount(String key,String name) {
        return vipinfoDao.getsearchCount(key,name);
    }

    /**
     * 搜索并分页显示
     * @return
     */
    public List<vipinfo> findsearchByPage(String key,String name,int pos, int size) {
        return vipinfoDao.findsearchByPage(key,name,pos, size);
    }

    /**
     * 添加
     * @param
     */
    public void add(vipinfo vipinfo) {
        vipinfoDao.add(vipinfo);
    }

    /**
     * 删除
     * @param id
     */
    public void delete(int id) {
        vipinfoDao.delete(id);
    }

    /**
     * 修改(先找到并显示，再修改)
     * @param
     */
    public List<vipinfo> getUserone(int id) {
        return vipinfoDao.getUserone(id);
    }
    public void update(vipinfo vipinfo) {
        vipinfoDao.update(vipinfo);
    }

    /**
     * 修改vip
     * @param
     */
    public void updatevip(vipinfo vipinfo) {
        vipinfoDao.updatevip(vipinfo);
    }

    /**
     * 每天自动查找是否过期vip
     * @param
     */
    public int search_id() {
        return vipinfoDao.search_id();
    }
    public void updatevipday(int uid) {
        vipinfoDao.updatevipday(uid);
    }
    public void updatevipdelete(int uid) {
        vipinfoDao.updatevipdelete(uid);
    }

}
